home *** CD-ROM | disk | FTP | other *** search
/ Power CD / Power CD ATARI-Rechner Lieben.iso / UTILITY / MENUDLX / BIN / GULAM.DOC next >
Encoding:
Text File  |  1991-08-16  |  28.8 KB  |  752 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                         A Ref Manual for
  7.  
  8.                           >> gulaam <<
  9.  
  10.                    Copyright (c) 1987 pm@Case
  11.                            April 1987
  12.  
  13. Gulaam   is   a   shell   (i.e.,  a command line interpreter) for
  14. AtariST  computers.    It   contains  some 50+ built-in commands,
  15. provides   file  name  completion  a la TENEX, has history, alias
  16. and  rehash   facilities,   and   integrates   the   shell   with
  17. microEmacs  easing  the  editing of commands being issued.  Among
  18. the  built-in  commands  are: egrep -- a regular expression based
  19. string  pattern  finder,  te -- a simple terminal emulator, rx/sx
  20. --  Xmodem  file  transfers,  and  pr -- a text file printer with
  21. pagination.   In  common  usage, it resembles csh of Unix 4.xBSD;
  22. Gulam's   control   structures,  lexical  conventions  and  other
  23. details  are,  however,  quite  different from csh.  While I have
  24. borrowed  ideas from other shells (such as Korn shell), I made no
  25. heroic  attempts  to  be  compatible with any.  Where possible, I
  26. have tried to make Gulam less 'surprising' in what it does.  
  27.  
  28.         Gulam is  a  free  program; you are encouraged to give it
  29. to  others,  but  at no cost.  However, the source is copyrighted
  30. and   will  be  part  of  a  book  on  systems  programming  I am
  31. writing.   The   source  is available on  request, with the usual
  32. provisos regarding material in manuscript form.  
  33.  
  34.         I am  advised  to  include a disclaimer because there are
  35. unreasonable people out there.   
  36.  
  37.     "I  make  no warranty with respect to this manual, or the
  38.     program  it  describes, and disclaim any implied/explicit
  39.     suggestions  of  usefulness  for  any particular purpose.
  40.     Use  this  program  only if you are willing to assume all
  41.     risks,  and damages, if any, arising as a result, even if
  42.     it is caused by negligence or other fault." 
  43.  
  44. On  the  other  hand,  I  know  of  no  bug  in  this version (>=
  45. 04/02/87).   However,  I  would be very surprised (and would ride
  46. on clouds for ever) if no bugs are discovered by others.   
  47.  
  48.         Many thanks  to:  Jwahar  R.  Bammi for all the help with
  49. TOS  calls,  and  demanding  that  Gulam  be  a  'reasonably full
  50. fledged'  shell;  David Conroy for writing a 'small is beautiful'
  51. microEmacs;   Henry Spencer for the regexp(3) package that is now
  52. built  into  Gulam;  David  Beckmeyer  for his malloc() routines;
  53. AtariST  for its value to price ratio.  The program was developed
  54. using Megamax and Mark Williams C compilers.  
  55.  
  56.  
  57.  
  58.                           Gulam Manual
  59.  
  60.  
  61.  
  62.                         Table of Contents 
  63.  
  64.  
  65. Comments on the Present Implementation    .................    2
  66. General Usage       .......................................    2
  67. Lexical Conventions       .................................    2
  68. Outline of Command Processing     .........................    3
  69. alias        ..............................................    3
  70. Batch Files       .........................................    4
  71. Buffers: Gulam Mini and Regular Buffers   .................    4
  72. Builtin Commands       ....................................    5
  73. cd        .................................................    5
  74. chmod [+-w] filenames      ................................    5
  75. Command Line Editing      .................................    5
  76. cp filenames target-dir      ..............................    6
  77. cp filename1 filename2      ...............................    6
  78. $cwd also $CWD      .......................................    6
  79. date        ...............................................    6
  80. df drivenames       .......................................    6
  81. dm        .................................................    7
  82. dir_cache dirc       ......................................    7
  83. dirs        ...............................................    7
  84. Dollar-substitutions        ...............................    7
  85. Dotg.g        .............................................    7
  86. echo        ...............................................    7
  87. ef        .................................................    7
  88. egrep        ..............................................    8
  89. endif        ..............................................    8
  90. endfor        .............................................    8
  91. $env_style        .........................................    8
  92. exit [number]       .......................................    8
  93. Expressions        ........................................    8
  94. fg        .................................................    8
  95. File Name Completion      .................................    9
  96. Flags        ..............................................    9
  97. foreach        ............................................    9
  98. format        .............................................    9
  99. gem        ................................................    9
  100. grep/egrep/fgrep re-pattern filenames      ................   10
  101. gulam.g        ............................................   10
  102. Gulam Variables and Environment     .......................   11
  103. HELP        ...............................................   13
  104. help        ...............................................   13
  105. history [-h]       ........................................   13
  106. History Substitutions       ...............................   13
  107. $home also $HOME      .....................................   13
  108. if        .................................................   14
  109. IO Redirection       ......................................   14
  110. lpr filenames       .......................................   14
  111. ls [-lRLF] filenames      .................................   14
  112. mem        ................................................   15
  113.  
  114.  
  115.  
  116.  
  117.  
  118.                           Gulam Manual
  119.  
  120.  
  121. Metacharacter Expansion       .............................   15
  122. mkdir names       .........................................   15
  123. more        ...............................................   15
  124. mv filenames target-dir      ..............................   15
  125. mv filename1 filename2      ...............................   15
  126. mson/msoff        .........................................   16
  127. PATH        ...............................................   16
  128. peekw and pokew      ......................................   16
  129. popd        ...............................................   16
  130. print filenames       .....................................   16
  131. printenv        ...........................................   17
  132. $prompt        ............................................   17
  133. pushd [dir]       .........................................   17
  134. pwd        ................................................   17
  135. Query Search/Replace       ................................   17
  136. Regular Expressions       .................................   18
  137. rehash        .............................................   19
  138. ren fnm1 fnm2      ........................................   19
  139. rm filenames       ........................................   19
  140. set [name value]      .....................................   20
  141. setenv        .............................................   20
  142. source file-name       ....................................   20
  143. status        .............................................   20
  144. Strings        ............................................   20
  145. sx        .................................................   21
  146. te/teexit        ..........................................   21
  147. Tenex File Name Completion     ............................   21
  148. time [command]       ......................................   21
  149. touch fnms       ..........................................   22
  150. ue [-r] [fnms]      .......................................   22
  151. uekb redefine microEmacs keybindings     ..................   22
  152. unalias [aliassed-name]       .............................   25
  153. unset [var-name]       ....................................   25
  154. unsetenv [env-var]       ..................................   25
  155. variables        ..........................................   25
  156. which        ..............................................   26
  157. while        ..............................................   26
  158.  
  159.  
  160.  
  161.  
  162. Comments on               Gulam Manual                          2
  163.  
  164.  
  165. >> Comments on the Present Implementation     << 
  166.  
  167. The   present  implementation  (dated  03/31/87)  is  incomplete.
  168. However,  I  find it eminently useable, and indeed use it all the
  169. time,  in  preference  to  other shells.  I am at a stage where I
  170. feel  further  effort in this program should be predicated on how
  171. useful  other  people  find this program; so, please tell me both
  172. the good and bad things about it.  
  173.  
  174.         Here are   some  features  that  I  find  unsatisfactory.
  175. Control  structures  are  quite  ad-hoc, and incomplete.  I had a
  176. tough  time  in  decreeing  that the typical "+-*/()[]{}" are not
  177. delimiters; but that decision made Gulam smaller.  
  178.  
  179.         Here are  some things that I hope to add in the months to
  180. come:  Procedures (with call by name?), keyboard macros available
  181. everywhere,  and  local editing of remote files (this is the real
  182. reason  why  rx/sx  are  built-in)  with  transparent transfer of
  183. portions of the file.  
  184.  
  185.         There are  a  couple  of  people here who are thinking if
  186. they  have  the  time  to port this program to Unix and MS-DOS; I
  187. think it will be quite routine.  
  188.  
  189. >> General Usage        << 
  190.  
  191. The  syntactic  details  of individual commands, and the sepcific
  192. rules  that  are  followed  in  evaluating  them are given later.
  193. This  section  is an overview of how the integration of ue with a
  194. shell is used.  
  195.  
  196.         The moment  you  enter  Gulam,  you  are  in  a ue-buffer
  197. called  >mini<.   Thus, all the typical ue text-editing functions
  198. are    available,    except    commands   such   as   Visit-file,
  199. Switch-to-buffer,  etc.   The -return- key causes the entire line
  200. (on  which  the return is typed) to be evaluated.  The output, if
  201. any,  of  the  command  you issued appears on the screen but does
  202. not  enter any ue-buffer.  The built-in command "ue" (without any
  203. arguments)  takes  you  into the special ue-buffer named >gulam<;
  204. the  output  of  (built-in)  commands  issued  while  you  are in
  205. >gulam<  does enter that buffer, which can be freely edited.  The
  206. command  "ue  <filenames>"  will  read-in each of the named files
  207. into    their    ue-buffers.    From   within   "ue",   you   can
  208. Switch-to-Gulam-buffer (whose default binding is ESC-g).  
  209.  
  210.         To conserve/manage  memory,  we  release  all  uE buffers
  211. when  uE  is  exited  in  the  usual  way (i.e., UNDO, or ^X-^C);
  212. exiting temporarily via the ^Z does not release memory.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222. Lexical Conventions       Gulam Manual                          3
  223.  
  224.  
  225. >> Lexical Conventions        << 
  226.  
  227. All  input  to  Gulam  is  case-sensitive; on the other hand, TOS
  228. file names are case-independent.  
  229.  
  230. The  evaluation  of  the command line  begins by dividing it into
  231. -words- and -subwords-.  The word-delimiters are: 
  232.  
  233. space   tab     return  line-feed       (the so-called white chars)
  234. single-quote    double-quote
  235. semicolon       vertical-bar
  236.  
  237.         Note that  +-*=/()[]{} etc. are *not* word-delimiters.  A
  238. word  is  either  (1)  a  sequence  of  chars  not containing any
  239. word-delimiters,  (2)  a  string  of  arbitrary chars enclosed in
  240. single/double-quotes, (3) a semicolon, or  (4) a vertical-bar.  
  241.  
  242. Eg,  the lines below 
  243.  
  244. date  01-22-87-22:08:34  #sets the TOS and ikbd date and time
  245. alias cl 'mmcc e:\gulam\$1.c; cp e:\gulam\$1.o .; linkmm l.lnk'
  246. if    {$x + $y ==23 }
  247. if    { -e $1.c }
  248.  
  249. would be divided into the words (shown between slashes) 
  250.  
  251. /date/01-22-87-22:08:34/#sets/the/TOS/and/ikbd/date/and/time/
  252. /alias/cl/'mmcc e:\gulam\$1.c; cp e:\gulam\$1.o .; linkmm l.lnk'/
  253. /if/{$x/+/$y/==23/}/
  254. /if/{/-e/$1.c/}/
  255.  
  256.         Comments begin  with  a  word  whose first char is #, and
  257. end  at  the  end  of line.  A # embedded in the middle of a word
  258. does not begin a comment.  
  259.  
  260.         The subword-delimiters      are      the     chars     in
  261. "!@#$%^&-=+`~{}:;'"\|,.<>/" 
  262.  
  263. >> Outline of Command Processing      << 
  264.  
  265. The   command   line   is   string   pre-processed   as described
  266. below before invoking it as a command.   
  267.  
  268. (1)  History substitutions occur first; (2) Dollar substitutions,
  269. wiggle  expansion,  meta  expansions  occur second; (3) Split the
  270. resulting  line  into semi-colon separated commands, (4) For each
  271. command,  alias  expand  it,  and  dollar-substitute; (5) Execute
  272. each resulting command.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. alias                     Gulam Manual                          4
  283.  
  284.  
  285. >> alias         << 
  286.  
  287. The  'alias'  built-in command works almost like a shell file but
  288. one  that is stored in the internal data structures of Gulam.  It
  289. often just specifies a shorter or different name for a command.  
  290.  
  291. alias cc c:\megamax\mmcc.ttp    #1
  292. unalias cc                      #2
  293. alias cl 'mmcc e:\gulam\$1.c; cp e:\gulam\$1.o .; linkmm l.lnk' #3
  294. alias r  'echo $1.c $1.o; r'    #4
  295. alias                           #5
  296. alias g 'echo $3 $1'            #6
  297. alias cg 'f:\cc.ttp -c -V -Ie:\gulam -DMWC e:\gulam\$1.c' #7
  298.  
  299. Alias  without  args  (see  #5)  lists  all  the aliases that are
  300. currently  defined.    The   command  unalias (see 2) removes the
  301. def  of an  alias.  Line 4 shows a recursive def; try it out!  If
  302. we  invoke  g as in 'g a b c d e f' this is equivalent to 'echo c
  303. a  d e f'; i.e., all arguments above the highest that was used in
  304. a  $-substitution  are  appended  to the resulting command string
  305. before executing it.  
  306.  
  307. >> Batch Files        << 
  308.  
  309. A  batch  file,  also  called  a  shell  file,  is  a  text  file
  310. containing  Gulam  commands,  both  internal  and external.  Such
  311. files  must  have the extension `.g' for them to be recognized as
  312. commands.   See  the  section  on  gulam.g  for  an example shell
  313. file.  
  314.  
  315. In  processing  these  files  Gulam  uses uE buffers.  So, if you
  316. have  `ue'  as  a  command in a batch file, and then exit uE with
  317. either  UNDO or ^X-^C, all the buffers (including the one holding
  318. the  batch  file)  will be released, and Gulam will surely crash.
  319. So, do NOT include ue as a command in a shell file.  
  320.  
  321. >> Buffers: Gulam Mini and Regular Buffers    << 
  322.  
  323. Once  you  invoke  Gulam, you are always in one of the microEmacs
  324. `buffers'  which  are  reservoirs  of  text.   In this program, a
  325. typical   line-oriented   command   shell   is   integrated  with
  326. microEmacs.   This  necessitated  two  special  kinds of buffers,
  327. named >gulam< and >mini<, along with the regular buffers.  
  328.  
  329. Right  after  you  invoke gulam, you are in >mini<, and each line
  330. you  type  is taken as a Gulam command, and executed.  Any output
  331. produced  by  such  a  command is displayed on the screen but not
  332. entered  into  any  microEmacs  buffer.   Should  you  desire  to
  333. capture  such  output  into a buffer, enter the >gulam< buffer by
  334. typing  `ue'  without  any  arguments.   If  you are editing in a
  335. regular  buffer elsewhere in microEmacs, pressing ESC-g (see uekb
  336. below  for  switch-to-Gulam-buffer)  will  get  you into >gulam<.
  337.  
  338.  
  339.  
  340.  
  341.  
  342. Buffers: Gulam            Gulam Manual                          5
  343.  
  344.  
  345. While  you  are  in >gulam<, the RETURN key behaves as it does in
  346. >mini<.  
  347.  
  348. All  command  input, including giving the names of buffers within
  349. ue,  takes place in >mini<.  The window for this buffer is always
  350. at  the  bottom of screen, and usually only one-line high.  (Some
  351. of  you  may  want  to experiment with ^X-^Z and ^X-z.) You enter
  352. the  >mini<  either  because  (A)  you  are  outside  the  normal
  353. microEmacs,  or  (B)  a command such as Switch-to-buffer wants to
  354. read  your  input.    The  >mini< is like any other buffer except
  355. for  the  bindings  of  a  few  keys,  and  the disallowing of ue
  356. functions   that  change/switch  buffers/windows/files.   One  of
  357. these  exceptional  keys  (in >mini<) is the RETURN key:  it will
  358. submit  the  entire  line  -- even if the cursor was somewhere in
  359. the  middle  of  the  line-- to the shell (case A), or to such ue
  360. commands  as  Visit-File  (case  B).  Until you press RETURN, you
  361. can  edit  not  only  that  line but others in >mini< just as you
  362. would in regular buffers.  
  363.  
  364. Note  that  unless you occasionally exit microEmacs with ^X-^C or
  365. UNDO,  both >gulam< and >mini< buffers will keep growing, and you
  366. may run out of memory.  
  367.  
  368.  
  369. >> Builtin Commands        << 
  370.  
  371. A   command   executed   directly   by   the  shell  is  called a
  372. built-in command.  The 61 built-in commands of Gulam are: 
  373.  
  374. alias    dirc     exit     history  msoff    pwd      source   unalias 
  375. cd       dirs     fg       if       mv       rehash   sx       unset 
  376. chmod    echo     fgrep    lpr      peekw    ren      te       unsetenv 
  377. copy     egrep    foreach  ls       pokew    rm       teexit   which 
  378. cp       ef       format   mem      popd     rmdir    time     while 
  379. date     endfor   gem      mkdir    print    rx       touch    
  380. df       endif    grep     more     printenv set      ue       
  381. dm       endwhile help     mson     pushd    setenv   uekb     
  382.  
  383. >> cd         << 
  384.  
  385. The   cd  command  changes   the    current working directory; it
  386. also  sets the shell variable named cwd, the environment variable
  387. named  CWD.  If cd was given noarguments,  it is equivalent to cd
  388. $home.  
  389.  
  390. >> chmod [+-w] filenames       << 
  391.  
  392. The  chmod  changes  the  read/write  attributes of the files: +w
  393. makes them read-write, and -w makes them read-only.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402. Command Line              Gulam Manual                          6
  403.  
  404.  
  405. >> Command Line Editing       << 
  406.  
  407. Full  microEmacs  editing  is available while typing the command.
  408. Thus,  you  can transopse chars by ^T, and go to the beginning of
  409. the line by ^A, and ^yank in a perviously deleted word, etc.  
  410.  
  411. In  addition  to  these,  there  are  three convenience features.
  412. After  typing  the  first  few chars of a file name, if you press
  413. the  key  marked  INSERT, Gulam will attempt to complete the file
  414. name;   pressing  CLR/HOME  will  show  all possible completions.
  415. Secondly,  if  you  type  !n  and then press INSERT, you will see
  416. that  the  history-expanded  result  is  brought into the buffer,
  417. which  can  then  be   further  edited  if  necessary.   Thirdly,
  418. pressing  the  DownArrow  key will cycle you through the previous
  419. commands.  
  420.  
  421. >> cp filenames target-dir       << 
  422. >> cp filename1 filename2       << 
  423.  
  424. Copies  files.   In  the  first  form, any number of files may be
  425. copied  into  the destination directory;  files in the target dir
  426. will  have  their  original  names.  In the second form, only one
  427. file is copied, and the new one will be named filename2.  
  428.  
  429.   cp fnm fnm    # will exit with status -1 
  430.   cp d1   dir2    #  if  d1  is  a  directory,  this command will
  431. createa dir 
  432.                 # named  d1  in dir2, and copies all the files in
  433. d1 to to 
  434.                 # dir2\d1 
  435.  
  436. There  is  a `+t' option that gives the created target files  the
  437. time  and  date of the source files.  If you care about this, you
  438. may want to set up an alias as in: 
  439.  
  440.   alias cp 'cp +t' 
  441.  
  442. >> $cwd also $CWD       << 
  443.  
  444. The   shell  variable named cwd (and env var named CWD) holds the
  445. full path name of the current working directory.  
  446.  
  447.  
  448. >> date         << 
  449.  
  450. The  date command, without arguments, prints the current date and
  451. time.  With arguments, it sets the date and time.  
  452.  
  453.         date 01-22-87-22:08:34 
  454.  
  455. will set the date to Jan 22, 87 and time to 10:08:34 pm.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462. df drivenames             Gulam Manual                          7
  463.  
  464.  
  465. >> df drivenames        << 
  466.  
  467. Df  shows the free space on the asked for drive(s); e.g., 'df a c
  468. f' 
  469.  
  470. >> dm         << 
  471.  
  472. -- drive map 
  473.  
  474. Gives a string of letters that stand for the installed drives.  
  475.  
  476. >> dir_cache dirc        << 
  477.  
  478. To  help  do the Tenex file name completion efficiently, there is
  479. a  cache  of  contents  of  directories.  Dirc shows the names of
  480. these  dirs,  and  how  many  bytes  are  used by their contents.
  481. Unless  you did a 'set dir_cache 1', the dirc has nothing to show
  482. since  the  cache  is  flushed  at  the end of each command.  Try
  483. Gulam  with  dir_cache set to 1.  Note however that this cache is
  484. updated  only  by  the  'ls'  command; so even after  you deleted
  485. some files, file name completion may still find those names.  
  486.  
  487. >> dirs         << 
  488.  
  489. Gulam  has  an  internal  stack  of  directories whose content is
  490. printed  by  the  dirs command.  The built-in commands pushd, and
  491. popd are the only others that operate on this stack.  
  492.  
  493. >> Dollar-substitutions         << 
  494.  
  495. The  subword   $x in a command is substituted by the value of it.
  496. If  x  is the name of a shell var, or an environment var, then $x
  497. is  the  value  of that variable.  If x is an unsigned number, it
  498. stands  for the x-th argument; thus, $0 usually gives the command
  499. name.   $*  stands  for the text of the entire command; $- stands
  500. for  words  $1  to dollar-last; $< stands for the on-demand input
  501. given by the user.  
  502.  
  503.  
  504. >> Dotg.g         << 
  505.  
  506. -- see Batch Files, and gulam.g 
  507.  
  508. >> echo         << 
  509.  
  510. The echo command prints its arguments.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522. ef                        Gulam Manual                          8
  523.  
  524.  
  525. >> ef         <<
  526. -- see if               (stands for elseif)
  527. >> egrep         <<
  528. -- see grep
  529. >> endif         <<
  530. -- see if
  531. >> endfor         <<
  532. -- see foreach
  533.  
  534. >> $env_style         << 
  535.  
  536. This  shell  var  controls  the  format of the environment string
  537. supplied to the external command invoked through Gulam.  
  538.  
  539. set env_style bm # to get a style of env string a la Beckmeyer
  540. set env_style mw # Mark Williams
  541. set env_style gu # the "normal" style, a la Unix
  542.  
  543. >> exit [number]        << 
  544.  
  545. The   exit  built-in  command  is  used to force termination of a
  546. shell script 
  547.  
  548. >> Expressions         << 
  549.  
  550. An  atomic  exp is either a number, a filename, a file predicate,
  551. a '{ exp }', or '! atomic exp'.  
  552.  
  553. A  file  predicate  on  a  file name fnm is of the form  '-c fnm'
  554. where  c  is  in  {e,  f,  d,  h, v, m}.  These letters stand for
  555. exists,     is-a-regular-file,     is-a-dir,    is-a-hidden-file,
  556. is-a-volume-label,  and is-an-archived-file.  A filepred yields 1
  557. if it is true, 0 otherwise.  
  558.  
  559. An  arithmetic  expression  is  constructed  using  the operators
  560. +-/%*   All   these   are   of  equal  precedence  and  evaluated
  561. left-to-right;  thus,  2  +  4  /  2 is equal to 3.  However, the
  562. braces  raise  the precedence of the ops within them; thus, 2 + {
  563. 6  /  2  }  is  equal  to 5.  An  exp with no operators, i.e., an
  564. atom,  is  a  special case because we want the string form of the
  565. atom  (e.g.,  as  for  "blah"  in  "set s blah").  A  non-numeric
  566. string yields 0 as its numeric value in an arith exp.  
  567.  
  568. A  relational  expression  is  of  the  form  `arithexp  relation
  569. arithexp',  where  relation  is  any  one of <=, <, ==, !=, >, or
  570. >=.   Such  a  relation  yields  a  1  if  it holds, 0 otherwise.
  571. (Relational  operators  among  strings  are not implemented yet.)
  572. You  may  combine  expressions using the boolean operators && and
  573. || (which are not, for now, short-circuit evaluated).  
  574.  
  575. Note the spaces in the examples above; see Lexical Structure.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582. fg                        Gulam Manual                          9
  583.  
  584.  
  585. >> fg         << 
  586.  
  587. Fg  is  part  of  the simulation of what we were used to doing on
  588. Unix  with  GNU-Emacs:  get  out  of  it  by  stopping GNU (^Z in
  589. ue/Gulam),  do a few shell commands and get back in  by fg (works
  590. the same in ue/Gulam).  
  591.  
  592. >> File Name Completion       << 
  593.  
  594. -- see Tenex ...  
  595.  
  596. >> Flags         << 
  597.  
  598. Most  commands  (built-in  or  external)  take flags to alter the
  599. behavior  of  the  command  in  a minor way.  The convention made
  600. popular  by  Unix shells is adopted here for Gulam's built-ins: a
  601. flag  is  of  the  form  `-c',  or  `+c',  where c stands for one
  602. character.   The  option '-i', which interrogates you for each of
  603. the  operand  of  the command before executing it, is provided on
  604. most commands.  
  605.  
  606. >> foreach         << 
  607.  
  608. The   foreach  command  is  used in shell scripts (but not at the
  609. terminal)  to   specify   repetition  of  a  sequence of commands
  610. while  the value of  a  certain  shell  variable  ranges  through
  611. a  specified  list.  The foreach command ends with an "enfdor" on
  612. a separate line all by itself.  
  613.  
  614.         foreach i { a b c *.o [a-k]*[ch] } 
  615.                 echo $i 
  616.         endfor 
  617.  
  618. >> format         << 
  619.  
  620. This  command  formats  diskettes, in the standard form (360K, or
  621. 720K)  in  either  the  A  or  B floppy drive.  It does not touch
  622. hard-/ram-disks,  no  matter  what arguments (illegal or not) you
  623. give  it.  Its valid arguments are either `a', `b', or both.  The
  624. optional  flag  `-2'  implies  double-sided formatting; otherwise
  625. the diskette is formatted single-sided.  
  626.  
  627.   format        # does nothing 
  628.   format b      # format the floppy in drive B, single-sided 
  629.   format -1 b   # same as format b 
  630.   format -2 a   # format the floppy in drive A, double-sided 
  631.  
  632. If  you  issue  the  wrong  command  (e.g.,  `format  -2  a' on a
  633. single-sided  drive),  you  will hear a lot of grinding noises; a
  634. control-C will kill this, but not right away.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642. gem                       Gulam Manual                         10
  643.  
  644.  
  645. >> gem         << 
  646.  
  647. The  word  "gem"  is a prefix, like "time" is, to commands.  This
  648. enables  proper  running  via Gulam of most programs that use the
  649. desktop  metaphor.   It  clears screen, turns cursor off, enables
  650. mouse  and  then  executes  the command, and after the command is
  651. finished  it  again  clears  screen,  turns  cursor  on, disables
  652. mouse.  
  653.  
  654. The  "time"  and  "gem"  prefixes  mix  in  either order, and the
  655. command name will be searched for in the usual way.  
  656.  
  657. We  do  not  know, for sure, if all desktop/window/mouse oriented
  658. programs  can  be  run  properly  with  this  command prefix.  So
  659. experiment,  and  be  ready  to hit the reset button before using
  660. the prefix.  
  661.  
  662. Dvi  is  an  example of a command that needs to be run with `gem'
  663. prefix.  And you may be tempted to do the following.  
  664.  
  665.   alias dvi 'gem dvi'                   # recurses infinitely 
  666.   alias dzz dvi                         # dzz or whatever 
  667.   alias dvi 'gem dzz'                   # will work 
  668.   alias dvi 'gem c:\bin\dvi.prg'        # also will work 
  669.  
  670. >> grep/egrep/fgrep re-pattern filenames       << 
  671.  
  672. The   grep  command searches through a list of argument files for
  673. a specified string.  Thus  
  674.  
  675.         grep lex[aw] e:\gulam\*.c 
  676.  
  677. will  print  each  line  in  the  files that contains a substring
  678. matching  lex[aw].   Grep   stands   for   `globally find regular
  679. expression  matches  and  print'.  Grep and egrep are one and the
  680. same.   The  first argument to egrep is a regular expression, and
  681. the  rest  are expected to be file names.  Fgrep's first argument
  682. is  the as-is string to be searched for in the files.  Because of
  683. the  preprocessing  done  by Gulam, the as-is string for fgrep or
  684. the   regular   exp   for   egrep   is   generally   enclosed  in
  685. single-quotes.  
  686.  
  687. >> gulam.g         << 
  688.  
  689. Files  with  the  .g  extension  are  expected  to  contain Gulam
  690. commands;  gulam.g  is  the  name  of  the  startup  file.  Gulam
  691. attempts  to  find  this  file  in  the current directory, and if
  692. found executes its contents.  Here is an example file: 
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702. gulam.g                   Gulam Manual                         11
  703.  
  704.  
  705. # bgn of my gulam.g
  706.  
  707. set prompt      '$ncmd $cwd gu > $u'
  708. set histfile    e:\history.g
  709. set baud_rate   9600
  710. set sz_rs232_buffer     4096
  711. set rgb         '005-707-070-075-' # set the palette; note the trailing '-'
  712. # the following sets tabs on Epson MX-80
  713. set pr_bof      '^Q033^QD^Q010^Q020^Q030^Q040^Q050^Q060^Q070^Q033^QC^Q102'
  714. set pr_eof      '^Q214'
  715. set pr_eop      '^Q214^Qn'
  716. set pr_eol      '^Qr^Qn'
  717.  
  718. setenv PATH c:\bin,d:\bin,f:    # no trailing back slashes
  719. rehash
  720. setenv TEMP f:\
  721. alias h   history
  722. alias ll  ls -lF
  723. alias p   more
  724. alias rm  rm -i # asks before deleting
  725. alias ug  'ue e:\gulam\$1.c'
  726. alias cg  'f:\cc.ttp -c -V -O -Ie:\gulam -Ie:\ue -DMWC e:\gulam\$1.c'
  727. alias cpall 'cp e:\ue\*.o e:\gulam*.o f:\ '
  728. alias bk  'cp e:\ue\*.[ch] e:\gulam\*.[ch] e:\gulam\mwc.s a:\ '
  729. # end of my gulam.g
  730.  
  731.  
  732.  
  733.  
  734. Gulam Variables           Gulam Manual                         12
  735.  
  736.  
  737. >> Gulam Variables and Environment      << 
  738.  
  739. The  following shell variables cause/control useful effects.  The
  740. format  of  the  explanation  is  `variable_name:  default-value;
  741. meaning'.  
  742.  
  743. batch_max_nesting: 20;  if  you need to nest batch file execution
  744.     at levels deeper than this, change this variable.  
  745. batch_echo: 0;  if  1  echoes each cmd of the batch file as it is
  746.     executed.  
  747. baud_rate:none; for  use  in  the  terminal  emulator, rx/sx file
  748.     transfers.  
  749. cwd:CWD: full  pathname  of  current directory; gets re-set every
  750.     time a cd, pushd or popd is executed.  
  751. dir_cache: 0; (if non-0, turns on the dir list cache) 
  752. home,HOME: full   pathname